package joodle.ui;
/**
 * Represents the "new" action on the menu bar
 */
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

import joodle.domain.Canvas;
import joodle.si.ResourceManager;

@SuppressWarnings("serial")
public class NewAction extends AbstractAction {

	public NewAction() {
		super(ResourceManager.message("NEW"), ResourceManager.makeIcon("new"));
		putValue(MNEMONIC_KEY, KeyEvent.VK_N);
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("control N"));		
	}
	/**
	 * @see AbstractAction#actionPerformed(ActionEvent)
	 */
	@Override
	public void actionPerformed(ActionEvent ae) {
		Canvas.instance().clear();
		CanvasComponent.instance().repaint();
	}

}
